import { request } from 'umi';
//获取文章列表  
export function getArticlesList(page:number=1){
    return request('/api/article',{
        params: {
            page,
            pageSize: 12,
            status:'publish'
          },
    })
}
// 获取文章详情
export function getArticleDetail(id: string) {
  return request(`/api/article/${id}`);
}

// 获取轮播
export function getArticleSwipers() {
    return request('/api/article/all/recommend');
  }
  // 首页导航数据
export function gitArticleNavList() {
  let params = {
    articleStatus: "public"
  }
  return request('/api/category', {
    params
  })
}

  // Nav--前端数据
export function getArticleFe(page: number = 1) {
    let params = {
      page,
      pageSize: 12,
      status: 'publish'
    }
    return request('/api/article/category/front', { params });
  }
  // Nav--后端数据
  export function getArticleBe(page: number = 1) {
    let params = {
      page,
      pageSize: 12,
      status: 'publish'
    }
    return request('/api/article/category/Be', { params });
  }
  // Nav--阅读数据
  export function getArticleReading(page: number = 1) {
    let params = {
      page,
      pageSize: 12,
      status: 'publish'
    }
    return request('/api/article/category/reading', { params });
  }
  // Nav--linux数据
  export function getArticleLinux(page: number = 1) {
    let params = {
      page,
      pageSize: 12,
      status: 'publish'
    }
    return request('/api/article/category/linux', { params });
  }
  // Nav--leetcode数据
  export function getArticleLeetcode(page: number = 1) {
    let params = {
      page,
      pageSize: 12,
      status: 'publish'
    }
    return request('/api/article/category/leetcode', { params });
  }
  // Nav--要闻数据
  export function getArticleNews(page: number = 1) {
    let params = {
      page,
      pageSize: 12,
      status: 'publish'
    }
    return request('/api/article/category/news', { params });
  }
  // Nav--Java数据
  export function getArticleJava(page: number = 1) {
    let params = {
      page,
      pageSize: 12,
      status: 'publish'
    }
    return request('/api/article/category/java', { params });
  }

// --------------------------------------------------
  //获取推荐阅读
export function getArticleRecommend() {
  return request(`/api/article/recommend`)
}
// 获取文章标签
export function getArticleState(){
  return request(`/api/tag?articleStatus=publish`)
}
 